<script setup lang="ts">
import { SearchTypeEnum } from '@/enums/SearchTypeEnum'
// 获取屏幕安全区域
const { safeAreaInsets } = uni.getSystemInfoSync()
console.log(safeAreaInsets)
const back = () => {
  uni.navigateBack()
}
const toSearch = () => {
  uni.navigateTo({ url: '/pages/search/search?type=' + SearchTypeEnum.GROUP })
}
</script>

<template>
  <view class="navbar" :style="{ paddingTop: safeAreaInsets?.top + 'px' }">
    <!-- <view class="logo">
      <image class="logo-image" src="@/static/images/logo.png" />
      <text class="logo-text">新鲜 亲民 快捷</text>
    </view> -->
    <!--  #ifndef  MP-ALIPAY -->
    <view class="back" @tap="back"><uni-icons type="left" size="20" /></view>
    <!--  #endif -->
    <view class="search" @tap="toSearch">
      <uni-icons class="icon" type="search" size="20" />
      <text class="icon-search">搜索小组</text>
    </view>
  </view>
</template>

<style lang="scss">
.navbar {
  position: relative;
  display: flex;
  flex-direction: row;

  // #ifdef MP-ALIPAY
  justify-content: start;
  height: 100rpx;
  padding: 30px 0 0 70rpx;
  padding-top: 20px;
  background-image: url(@/static/home/navigator_bg.png);
  // background-color: #90D7EC;
  background-size: cover;
  // #endif

  .back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64rpx;
    height: 64rpx;
    padding: 0 10rpx 0 0;
    margin: 16rpx 10rpx;
    font-size: 28rpx;
    color: #fff;
  }

  .logo {
    display: flex;
    align-items: center;
    height: 64rpx;
    padding-left: 30rpx;

    .logo-image {
      width: 166rpx;
      height: 39rpx;
    }

    .logo-text {
      flex: 1;
      padding-left: 20rpx;
      margin: 2rpx 0 0 20rpx;
      font-size: 26rpx;
      line-height: 28rpx;
      color: #fff;
      border-left: 1rpx solid #fff;
    }
  }

  .search {
    display: flex;
    align-items: center;
    justify-content: start;
    width: 50%;
    height: 64rpx;
    padding: 0 10rpx 0 26rpx;
    margin: 16rpx 10rpx;
    font-size: 28rpx;
    color: #fff;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 32rpx;

    .icon {
      opacity: 0.5;
    }
  }

  .icon-search {
    color: rgb(130, 130, 130);
    &::before {
      margin-right: 10rpx;
    }
  }

  .icon-scan {
    padding: 15rpx;
    font-size: 30rpx;
  }
}
</style>
